//
//  NSDictionary+Helper.m
//  crowd
//
//  Created by 王春程 on 16/4/28.
//  Copyright © 2016年 caocaod.com. All rights reserved.
//

#import "NSDictionary+Helper.h"

@implementation NSDictionary (Helper)
+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString {
    if (jsonString == nil) {
        return nil;
    }
    
    NSString *newJsonString =[jsonString stringByTrimmingCharactersInSet:[NSCharacterSet controlCharacterSet]];
    
    NSData *jsonData = [newJsonString dataUsingEncoding:NSUTF8StringEncoding];
    NSError *err;
    NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData
                                                        options:NSJSONReadingMutableContainers
                                                          error:&err];
    if(err) {
        NSLog(@"json解析失败：%@",err);
        return nil;
    }
    return dic;
}
@end
